﻿using System;
using System.Collections.Generic;

using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Pager;
using X.Pager.List;
using X.Common;

namespace E.Web.training.internals.publics.classes
{
    public partial class InternalPublicClassList : BasePage
    {
        public Dictionary<int, string> courseList = new Dictionary<int, string>();
        public string act, classCode;
        public int courseid;
        public IList<InternalPublicClassModel> classList;

        protected override void ShowPage()
        {
            courseList = (new CourseBLL()).GetInternalPublicCourseList();

            act = XRequest.GetString("act");
            classCode = XRequest.GetString("ClassCodeTxt");
            courseid = XRequest.GetInt("CourseSlt", -1);

            if (ispost || act == "s")
            {
                ClassBLL bll = new ClassBLL();

                InternalPublicClassSearchModel searchModel = new InternalPublicClassSearchModel();
                searchModel.ClassCode = classCode;
                searchModel.CourseID = courseid;
                searchModel.ProjectID = -1;

                InternalPublicClassListModel listModel = new InternalPublicClassListModel();

                CheckPageIndexValue(XRequest.GetInt("s", 1) - 1, XRequest.GetInt("g", 0), XRequest.GetInt("z", customerPageSize));

                listModel = bll.GetInternalPublicClassListByCondition(searchModel, customerPageSize, pageIndex);
                if (listModel.TotalCount > 0)
                {
                    count = listModel.TotalCount;
                    classList = listModel.List;
                    PagerBase pager = new ListPager(count, pageIndex, currentPgGroup, customerPageSize, defaultPagesInGroup);

                    Dictionary<string, string> parms = new Dictionary<string, string>();
                    parms.Add("act", act);
                    parms.Add("ClassCodeTxt", classCode);
                    parms.Add("CourseSlt", courseid.ToString());
                    parms.Add("AreaSlt", areaid.ToString());
                    mypager = pager.DrawPager("selfpager", parms);
                }
                //}
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
